<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<f:view locale="#{salaoMB.internacionalizacao.currentLocale}">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<title>Datas de não funcionamento</title>
</h:head>
<h:body>

	<table width="100%">
	<tr>
		<td><ui:include src="/index.xhtml" /></td>
	</tr>
	</table>
		
	<h:form id="datasEstabelecimentoFechado" prependId="false">
	
		<p:messages id="msg" showDetail="true" autoUpdate="true" closable="true" />  
		
		<p:contextMenu> 
	 		<p:menuitem value="Menu Principal" url="/pages/main.faces" icon="ui-icon-extlink"/>
		</p:contextMenu>
		
		<table width="40%" align="center">
			<tr>
				<td><p:panel header="Datas para agendamento não disponível">

						<h:panelGrid id="datasEstabelecimentoSemExpediente" columns="2" cellpadding="5">

						<h:outputText id="textEstabelecimento" value="Estabelecimento: " />
						 		
						 <h:selectOneMenu value="#{dateBusyMB.idSelectedEstabelecimento}" rendered="true" id="estabelecimento" immediate="true" >			
							 <f:selectItem itemLabel="Selecione..." itemValue="0" noSelectionOption="true"/>
							 <f:selectItems value="#{dateBusyMB.mapEstabelecimento}" var="estabelecimento" itemLabel="#{estabelecimento.nomeFantasia}" itemValue="{estabelecimento.id}" />							   		
						 </h:selectOneMenu>  

							<h:outputText
								value="Insira as datas em que o Estabelecimento estará fechado: " />
							<p:calendar value="#{dateBusyMB.datasFechadasEstabelecimento.dateBusy}" mode="inline"  pages="3"
								id="dateBusyCalendar" />

							<p:commandButton type="submit"
								action="#{dateBusyMB.includeDateBusy}" value="Gravar"
								icon="ui-icon-disk" update="dateBusy"/>
								
						</h:panelGrid>
						
						</p:panel>
						<br /> <br />
						
						<p:panel header="Datas configuradas:">
						
						<h:panelGrid id="datasTable" columns="3" cellpadding="5" >
						
						<h:outputText id="textEstabelecimento2" value="Estabelecimento: " />
						<h:selectOneMenu value="#{dateBusyMB.idSelectedEstabelecimento2}" rendered="true" id="estabelecimento2" immediate="true" >			
							 <f:selectItem itemLabel="Selecione..." itemValue="0" noSelectionOption="true"/>
							 <f:selectItems value="#{dateBusyMB.mapEstabelecimento}" var="estabelecimento" itemLabel="#{estabelecimento.nomeFantasia}" itemValue="{estabelecimento.id}" />							   		
						 </h:selectOneMenu> 
						 
						
						 <h:commandLink id="btnFind" update="dateBusy" action="#{dateBusyMB.carregarDatasFechadasPorEstabelecimento}">
                    			<p:graphicImage value="/img/find.gif" width="20" height="20"/>
                    	</h:commandLink>
						 
						 </h:panelGrid>
						 
						<p:dataTable id="dateBusy" var="datasND"
							value="#{dateBusyMB.listaDatasFechadas}" emptyMessage="N&atilde;o há dados registrados para o estabelecimento selecionado">
							
							<f:facet name="header">  
					            Estabelecimento
					        </f:facet> 

							<p:column headerText="Raz&atilde;o Social: " sortBy="#{datasND.estabelecimento.razaoSocial}">
								#{datasND.estabelecimento.razaoSocial}
							</p:column>
							
							<p:column headerText="Nome Fantasia: " sortBy="#{datasND.estabelecimento.nomeFantasia}">
								#{datasND.estabelecimento.nomeFantasia}
							</p:column>							

							<p:column headerText="Data" sortBy="#{datasND.dateBusy}">
								#{datasND.dateBusy}
							</p:column>

						</p:dataTable>

					</p:panel>
				</td>
			</tr>
		</table>
	</h:form>
</h:body>
</f:view>
</html>